//
// Description: 6028. 统计道路上的碰撞次数
// Created by Loading on 2022/3/20.
//

#include <bits/stdc++.h>

using namespace std;

int countCollisions(string directions) {
    int res = 0;

    // 前缀向左的车不会发生碰撞
    int l = directions.find_first_not_of('L');
    // 后缀向右的车不会发生碰撞
    int r = directions.find_last_not_of('R');
    // 全部向左或全部向右，必然不会碰撞
    if (l == string::npos || r == string::npos) {
        return 0;
    }
    // 剩下非静止的车必然发生碰撞
    for (int i = l; i <= r; ++i) {
        if (directions[i] != 'S') {
            ++res;
        }
    }

    return res;
}

int main() {
    string directions = "L";
    int res = countCollisions(directions);
    cout << res << endl;

    return 0;
}